﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Styx;
using Styx.Helpers;
using Styx.Logic.BehaviorTree;
using Styx.Plugins.PluginClass;
using Styx.Logic;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

namespace ProfileHelper
{
    internal static class QuestAccept
    {
        public static void Accept(object sender, LuaEventArgs args)
        {
            //0 - Value: Little Orphan Roo Of The Oracles
            //1 - Value: 73
            //2 - Value: 
            //3 - Value: 0
            //4 - Value: 
            //5 - Value: 
            //6 - Value: 
            //7 - Value: 
            //8 - Value: 13926
            //9 - Value: 
            //10 - Value:

            // Example
            //<PickUp Questname="The Grimtotem are Coming" QuestId="25486" GiverName="Caryssia Moonhunter" GiverId="39946"  X="-4464.863" Y="-540.342" Z="5.571152" />
           

            

            List<string> Values = Lua.GetReturnValues(string.Format("return GetQuestLogTitle({0})", args.Args[0].ToString()));
            string QuestName = Values[0];
            uint QuestID = uint.Parse(Values[8]);

            WoWUnit Target = StyxWoW.Me.CurrentTarget;
            Log.Write("<PickUp Questname=\"{0}\" QuestId=\"{1}\" GiverName=\"{2}\" GiverId=\"{3}\"  X=\"{4}\" Y=\"{5}\" Z=\"{6}\" />", QuestName, QuestID, Target.Name, Target.Entry, Target.X, Target.Y, Target.Z);

            // Test
            QuestObjective.DisplayShit(QuestID);
        }
    }
}
